Skip to content

Added GHE enterprise connection option#25

Open
nikbanerjee wants to merge 2 commits into
strongloop-internal:masterfrom
nikbanerjee:master
Open

Added GHE enterprise connection option#25
nikbanerjee wants to merge 2 commits into
strongloop-internal:masterfrom
nikbanerjee:master

Conversation

@nikbanerjee

Copy link
Copy Markdown

Added option to connect to GitHub Enterprise by specifying GHE host in .auth.json.

If host name is not added then connection will default to github.com.

cc @rmg

@slnode

slnode commented Mar 20, 2017

Copy link
Copy Markdown

Can one of the admins verify this patch?

@ghost ghost added the #plan label Mar 20, 2017

@rmg rmg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this code, I would expect the majority of this PR to be the ~10 or so lines that are added to the README.md and only a few lines needing to be added to the actual code.

Comment thread README.md
{
"username": "github-username",
"password": "github-password",
"enterprise_host": "github.your-GHE-company.com"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since GHE exposes the same API and all of the clients treat it exactly the same, it would be better to just have a single GH URL option that simply defaults to https://api.github.com/.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So have a field for the host with api.github.com and allow it to be changed? Because the current way it works is it defaults to api.github.com if no enterprise_host is specified.

Comment thread lib/create-client.js
if (ghe_host) {
console.info("Connecting to GitHub Enterprise (" + ghe_host + ")..")
github_params.host = ghe_host;
github_params.pathPrefix = "/api/v3"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the company specific URL and admins are actually free to use just about whatever root URL they like, so this is pretty specific to one company's GHE deployment.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would I have the user specify the pathPrefix as well then?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the module being used.. seems they made the rather unfortunate choice of splitting the URL like this. I thought it was smarter than that :-(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I would do is make the config use a url and then parse it on load. Something like this maybe?

var ghUrl = require('url').parse(auth.url || 'https://api.github.com');
github_params.host = ghUrl.host;
github_params.pathPrefix = ghUrl.path;
console.info('Connecting to: %s', ghUrl.format());

Comment thread README.md Outdated
```
{
"username": "github-username",
"password": "github-password",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to use token for the GHE example, IMNSHO, since basic auth support is optional and token auth is generally preferred in all circumstances.

@rmg

rmg commented Mar 20, 2017

Copy link
Copy Markdown
Contributor

@nikbanerjee you should add your IBM email address to your github.com profile so that your commits are properly connected to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants